import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

const modules: any = import.meta.globEager('../views/*.vue')

export const routes: Array<RouteRecordRaw> = Object.entries(modules).map(([path, module]) => {
  const name = path.split('/').slice(-1)[0].replace('.vue', '')
  return {
    path: '/' + name,
    name,
    component: module.default,
  }
})
routes.unshift({
  path: '/',
  name: 'Index',
  redirect: 'Gen2DViewDemo', // routes[0].path,
  meta: {
    hide: true,
  }
})

export default createRouter({
  history: createWebHashHistory(),
  routes,
});